<?php
function scanFile(string $file,array $banCommand,string $explodeBy)
{
    $sqlS=[];
    $fp=fopen($file,"r");

    $list = array('GBK', 'UTF-8', 'UTF-16LE', 'UTF-16BE', 'ISO-8859-1');
    $str = fread($fp,filesize($file));
    foreach ($list as $item)
    {
        if(md5($tmp=mb_convert_encoding($str, $item, $item)) == md5($str))
        {
            $str=mb_convert_encoding($str,'UTF-8',$item);
            break;
        }
    }


    foreach(explode($explodeBy,$str) as $one)
    {
        foreach($banCommand as $_)
            if(strpos(strtoupper($one),strtoupper($_))!==false)
            {
                $one='';
                break;
            }
        if($one!='')
            $sqlS[]=$explodeBy.$one;
    }
    fclose($fp);
    return $sqlS;
}